

function recommend(path,typeId) {
    var url = path+"blog/recommend";
    jQuery.ajax({
        type: "POST",
        url: url ,
        data: {"typeId": typeId},
        dataType: "json",
        success: function (data) {
            if (data.success) {
                var blogStr = "<a href="+path+"blog/view/" + data.data.blogId + " \"   target=\"_blank\">" + data.data.blogAbstract + "</a>";
                $("#recommentInfo").append(blogStr);
                $("#recommend").show();
            } else {
                $("#recommend").hide();
            }
        }
    });
}

function recommendClassify(path,typeId) {
    var url = path+"blog/recommend";
    jQuery.ajax({
        type: "POST",
        url:  url,
        data: {"typeId": typeId},
        dataType: "json",
        success: function (data) {
            if (data.success) {
                var blogStr = "<a href="+path+"blog/view/" + data.data.blogId + " \"   target=\"_blank\">" + data.data.blogTitle + "</a>";
                $("#recommendTitle").append(blogStr);
                $("#recommendAbstract").append(data.data.blogAbstract);
                $("#recommendcDate").append("发表于 " + data.data.cDate + " 阅读(" + data.data.views + ")");
                $("#recommend").show();
            } else {
                $("#recommend").hide();
            }
        }
    });
}

function hotKeys(path) {
    jQuery.ajax({
        type: "POST",
        url: path+"blog/keyword/hotKey",
        data: "",
        dataType: "json",
        success: function (data) {
            if (data.success) {
                $.each(data.data, function (i, item) {
                    var keyStr = "<li><span><a href="+path+"blog/keyword/"+ item.keyWordId +"/0  \"   target=\"_blank\">" + item.keyWord + "("+item.blogCount +")</a></span></li>";
                    $("#hotKeys").append(keyStr);
                });
            }
        }
    });
}

function hotBlog(path) {
    jQuery.ajax({
        type: "POST",
        url: path+"blog/blogTop",
        data: "",
        dataType: "json",
        success: function (data) {
            if (data.success) {
                $.each(data.data, function (i, item) {
                    var blogStr = "<li><span><a href="+path+"blog/view/"+ item.blogId +" \"   target=\"_blank\">" + item.blogTitle + "("+item.views +")</a></span></li>";
                    $("#blogTop").append(blogStr);
                });
            }
        }
    });
}

function activeUser(path) {
    jQuery.ajax({
        type: "POST",
        url: path+"user/active",
        data: "",
        dataType: "json",
        success: function (data) {
            if (data.success) {
                $.each(data.data, function (i, item) {
                    var userStr = "<li><span><a href="+path+"blog/view/"+ item.blogId +" \"   target=\"_blank\">" + item.userName +"</a></span></li>";
                    $("#activeUser").append(userStr);
                });
            }
        }
    });
}